lst = [86,87,88,89,90,91,92,93,00,96,97]
print(lst)

# 第一种方式
# lst2 = []
# for item in lst:
#     if item :
#         lst2.append('19'+str(item))
#     else :
#         lst2.append('200'+str(item))
# print(lst2)

# 第二种
# for i , item in enumerate(lst):
#     if item:
#         lst[i] = '19'+str(item)
#     else :
#         lst[i] = '200'+str(item)
#
# print(lst)

# 第三种
for i in range(len(lst)) :
    if lst[i]:
        lst[i] = '19'+str(lst[i])
    else :
        lst[i] = '200'+str(lst[i])
print(lst)



# 模拟购物车，先添加商品， 之后输入编号加入购物车，输入q退出并打印购物车信息
# zips = {}
# car = {}
# n = 0
# while  n<3:
#     name = input('请录入商品：')
#     key = name[0:3]
#     value = name[4:]
#     zips[key] = value
#     n+=1
# for key ,item in zips.items() :
#     print(key,'-->',item)
#
#
# while True :
#     flag = True;
#     keynum = input('请输入商品编号加入到购物车')
#     if zips.get(keynum) :
#         print('成功加入购物车')
#         car[keynum] = zips.get(keynum)
#     elif keynum == 'q':
#         flag = False
#         break;
#     else :
#         print('加入购物车失败，未找到商品')
#
# print('-'*50)
# print('您购买的商品如下：')
# for key,value in car.items() :
#     print(key,'-->',value)


# 模拟12306购票
train = {
    "G183":['北京-保定','19:49',"20:13",'30分钟'],
    "G184": ['北京-保定', '19:49', "20:13", '10分钟'],
    "G185": ['北京-保定', '19:49', "20:13", '20分钟'],
    "G186": ['北京-保定', '19:49', "20:13", '90分钟'],
    "G187": ['北京-保定', '19:49', "20:13", '60分钟'],
}
print(train.get('G183')[0:1])
print('车次','出发站-始发站', '起点', '到点', '运行时长')
for item in train.keys():
    print(item, end=" ")
    for item in train[item]:
        print(item,end=" ")
    print()

while True :
    carName = input('请输入车次')
    if train.get(carName):
        username = input('请输入乘车人，多个人用豆号分隔')
        vstr = str(train.get(carName)[0]) +'始发时间：'+train.get(carName)[1]
        print(vstr)
        print('您已购买了', carName, vstr, '请', username, '尽快兑换车票！！')
    else :
        print('对不起，未找到车次')







